<h2>Corporate Individual</h2>
<!-- Content Box Tab Navigation -->
<nav>
    <ul class="tab-switch">
        <li><a id="crud_data" href="#tab1" class="default-tab blue">View Entries</a></li>
        <?php if($sf_user->hasPermission('submit')): ?>
        <li><a id="crud_new" href="#tab2" class="blue">New</a></li>
        <?php endif; ?>
        <!--<li><a id="crud_edit" href="#tab2" class="tooltip" title="Edit Application">Edit</a></li>
        <li><a id="crud_delete" href="javascript:void(0)" class="tooltip" title="Delete Application">Delete</a></li>
        <li><a id="crud_print" href="javascript:void(0)">Print</a></li>-->
    </ul>
</nav>
<!-- /Content Box Tab Navigation -->

<script type="text/javascript">

var defSelected = $("#crud_data");

setDefaultSelected = function() {
	$(".tab-switch a").parent().siblings().find('a').removeClass("current");
    $(defSelected).addClass("current");
}

$(document).ready(function(){

    // redraw table
    $("#crud_data").click(function(){
      editing = false;
      tableReload();
      $('div.formError').remove();
    });

    // request forms
    $("#crud_new").click(function(){
    	defSelected = this;
      if(editing == false) {
        toggleLoading();
        $("#tab2-content").empty();
        $.ajax({
            url: '<?php echo url_for("corporateindividual/ajaxNewForm") ?>',
            type: 'POST',
            dataType: 'html',
            success: function(response) {
                $("#tab2-content").html(response);
                toggleLoading();
            }
        });
      }
    });


});
</script>